package fr.cephb.joperon.core.bio;

/** static methods for protein */
public class AminoAcidUtil
	{
	/** Mario Foglio's method for encoding an amino acid to an int */
	public static char decode(int base)
		{
		switch(base)
			{
			case   1: return 'A';
			case   2: return 'C';
			case   3: return 'G';
			case   4: return 'T';
			case   5: return 'B';
			case   6: return 'D';
			case   7: return 'H';
			case   8: return 'K';
			case   9: return 'M';
			case  10: return 'R';
			case  11: return 'S';
			case  12: return 'V';
			case  13: return 'W';
			case  14: return 'Y';
			case  15: return '-';
			case  16: return ' ';
			case  17: return 'X';
			case  18: return 'N';
			case  19: return 'Q';
			case  20: return 'E';
			case  21: return 'I';
			case  22: return 'L';
			case  23: return 'F';
			case  24: return 'P';
			case  25: return 'O';
			case  26: return 'U';
			case  27: return 'Z';
			case  28: return 'J';
			case  29: return '*';
			default : return  0;
			}
		}
	
	/** Mario Foglio's method for decoding an amino acid from an int */
	public static int encode(char base)
		{
		switch(base)
			{
			case 'A': return  1;
			case 'C': return  2;
			case 'G': return  3;
			case 'T': return  4;
			case 'B': return  5;
			case 'D': return  6;
			case 'H': return  7;
			case 'K': return  8;
			case 'M': return  9;
			case 'R': return 10;
			case 'S': return 11;
			case 'V': return 12;
			case 'W': return 13;
			case 'Y': return 14;
			case '-': return 15;
			case ' ': return 16;
			case 'X': return 17;
			case 'N': return 18;
			case 'Q': return 19;
			case 'E': return 20;
			case 'I': return 21;
			case 'L': return 22;
			case 'F': return 23;
			case 'P': return 24;
			case 'O': return 25;
			case 'U': return 26;
			case 'Z': return 27;
			case 'J': return 28;
			case '*': return 29;
			default : return  0;
			}
		}	
	
}
